﻿namespace DataAccess.Tools
{
    /// <summary>
    /// 工具帮助类
    /// </summary>
    public class ToolHelper
    {
        /// <summary>
        /// 首字母大写
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string ToTitleCase(string value)
        {
            return value.Substring(0, 1).ToUpper() + value.Substring(1);
        }

        /// <summary>
        /// 转驼峰命名法
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string ToHumpCase(string value)
        {
            var result = string.Empty;
            if (string.IsNullOrWhiteSpace(value) == false)
            {
                var splits = value.Split('_','-');
                foreach (var item in splits)
                {
                    result += ToTitleCase(item);
                }
            }
            return result;
        }
    }
}
